package com.xms.schema.service.stringmap;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xms.datacore.service.FinderService;
import com.xms.schema.entity.StringMap;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

/**
 * <p>
 * StringMapFinderService
 * </p>
 *
 * @author migo
 * @since 2021/9/8
 */
@CacheConfig(cacheNames = "schema.stringmap", keyGenerator = "CacheKeyGenerator")
@Service
public class StringMapFinderService extends FinderService<StringMap> implements IStringMapFinderService {

    @Cacheable(condition="#attributeid != null")
    @Override
    public List<StringMap> getByAttributeid(UUID attributeid) {
        QueryWrapper<StringMap> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(StringMap::getAttributeid, attributeid);
        return super.list(queryWrapper);
    }

    @Cacheable(condition="#id != null")
    @Override
    public StringMap getById(UUID id) {
        return super.getById(id);
    }

    @Cacheable(condition="#idList != null && #idList.size() > 0")
    @Override
    public List<StringMap> getByIds(Collection<UUID> idList) {
        return super.listByIds(idList);
    }

    @Cacheable()
    @Override
    public StringMap getOne(Wrapper<StringMap> queryWrapper) {
        return super.getOne(queryWrapper);
    }

    @Cacheable()
    @Override
    public int count() {
        return super.count();
    }

    @Cacheable()
    @Override
    public int count(Wrapper<StringMap> queryWrapper) {
        return super.count(queryWrapper);
    }

    @Cacheable()
    @Override
    public List<StringMap> list(Wrapper<StringMap> queryWrapper) {
        return super.list(queryWrapper);
    }

    @Cacheable()
    @Override
    public List<StringMap> all() {
        return super.list();
    }
}
